package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.Book;
import com.example.entity.Log;
import com.example.entity.Params;
import com.example.mapper.BookMapper;
import com.example.mapper.LogMapper;
import com.example.service.BookService;
import com.example.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: PengFei.He
 * @Date: 2024/11/6 19:52
 * @Function:
 */

@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, Log> implements LogService {

    @Autowired
    private LogMapper logMapper;


    @Override
    public List<Log> findBySearch(Params params) {
        return logMapper.findBySearch(params);
    }

    // 新增和编辑公用一个接口
    @Override
    public void add(Log log) {
        if (log.getId() == null){
            logMapper.insert(log);
        }
        logMapper.updateById(log);
    }
}
